package com.hsgene.product.persistence;

import com.hsgene.product.condition.CommodityCategoryCondition;
import com.hsgene.product.domain.GeneticCommodityCategory;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface GeneticCommodityCategoryMapper {
    int deleteByPrimaryKey(String id);

    int insert(GeneticCommodityCategory record);

    int insertSelective(GeneticCommodityCategory record);

    GeneticCommodityCategory selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(GeneticCommodityCategory record);

    int updateByPrimaryKey(GeneticCommodityCategory record);

    /**
     * 根据类目名称查找
     * @param commodityCategory
     * @return
     */
    GeneticCommodityCategory getByName(GeneticCommodityCategory commodityCategory);

    /**
     * 列表获取总数
     * @param condition
     * @return
     */
    int queryCategoryCount(@Param("condition") CommodityCategoryCondition condition);

    /**
     * @Description 商品类目列表
     * @Author FX
     * @CreateDate 2018/10/16 17:52
     * @param condition
     * @Return
     */
    List<GeneticCommodityCategory> queryCategory(@Param("condition") CommodityCategoryCondition condition);
    /**
     * 获取全部
     * @description
     * @author FX
     * @CreateDate 2018/10/16 17:56
     * @param id
     * @return
     */
    List<GeneticCommodityCategory> getAll();

    /**
     * 更新商品类目使用次数（以原子方式加1或减1）
     *
     * @param categoryId 类目id
     * @param isAddition true：增加；false：减少
     * @return 更新结果
     */
    void updateCategoryUsedCount(@Param("categoryId") String categoryId, @Param("isAddition") boolean isAddition);
}